//
//  HomeViewController.m
//  RongIMDemo
//
//  Created by cuifengju on 2020/5/7.
//  Copyright © 2020 崔逢举. All rights reserved.
//

#import "HomeViewController.h"
#import "ChatViewController.h"
@interface HomeViewController ()

@property (nonatomic,strong)UIButton *privateChatButton;

@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tabBarController.navigationItem.title = @"会话";
    self.privateChatButton.frame = CGRectMake(50, 200, self.view.bounds.size.width - 100, 44);
    [self.view addSubview:self.privateChatButton];
    
}

- (void)chatWithPrivite {
    ChatViewController *chatVC = [[ChatViewController alloc] initWithUserName:@"大头" targetId:@"15000939236"];
    [self.navigationController pushViewController:chatVC animated:YES];
}

#pragma mark --- lazy loading ---

- (UIButton *)privateChatButton {
    if (_privateChatButton == nil) {
        _privateChatButton = [[UIButton alloc]init];
        _privateChatButton.titleLabel.font = [UIFont systemFontOfSize:15];
        _privateChatButton.titleLabel.textAlignment = NSTextAlignmentCenter;
        [_privateChatButton setTitle:@"开始单聊" forState:UIControlStateNormal];
        _privateChatButton.backgroundColor = UIColorFromRGB(0x1E8DFE);
        _privateChatButton.layer.cornerRadius = 22;
        _privateChatButton.layer.masksToBounds = YES;
        [_privateChatButton addTarget:self action:@selector(chatWithPrivite) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return _privateChatButton;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
